﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UsersList.aspx.cs" Inherits="ModulesToolkit.Membership.Views.UsersList"
    Title="UsersList" MasterPageFile="~/Shared/DefaultMaster.master" %>

<asp:Content ID="content" ContentPlaceHolderID="uxDefaultContentPlaceHolder" runat="Server">
    <h1>
        Users List</h1>
    <table width="100%">
        <tr>
            <td>
                Full Name
            </td>
            <td>
                <asp:TextBox runat="server" ID="txtFullName"/>
            </td>
            <td>
                E-mail
            </td>
            <td>
                <asp:TextBox runat="server" ID="txtMail" />
            </td>
        </tr>
        <tr>
            <td>
                Username
            </td>
            <td>
                <asp:TextBox runat="server" ID="txtUserName" />
            </td>
            <td>
                Enabled
            </td>
            <td>
                <asp:DropDownList runat="server" ID="uxIsEnabled">
                    <asp:ListItem Value="true">Yes</asp:ListItem>
                    <asp:ListItem Value="false">No</asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Button ID="btnSearch" runat="server" Text="Search" OnClick="btnSearch_Click" />
            </td>
            <td>
            </td>
            <td>
            </td>
            <td align="right">
                <asp:Button ID="btnAdd" runat="server" Text="Add" OnClick="btnAdd_Click" />
                

                <mtl:Popup runat="server" ID="uxPopup" Title="User Details" CloseImageUrl="~/Images/Delete16.png"
                    Width="500px">
                    <ContentTemplate>
                        <div>
        <table width="100%">
            <tr>
                <td>
                    <asp:Label text="<%$ Resources:Content, 0002 %>" runat="server" />
                </td>
            </tr>
            <tr>
                <td>
                        Full Name*
                </td>
                <td>
                    
                    <asp:TextBox ID="uxName" runat="server" />
                </td>
                <td>
                <asp:RequiredFieldValidator ID="reqFullName" runat="server" controltovalidate="uxName" ErrorMessage="<%$ Resources:Error, 0001 %>"></asp:RequiredFieldValidator>
                 <asp:RegularExpressionValidator ID="regexpName" runat="server"     
                                    ErrorMessage="<%$ Resources:Error, 0002 %>" 
                                    ControlToValidate="uxName"     
                                    ValidationExpression="^[a-zA-Z'.\s]{1,40}$" />

                </td>
            </tr>
            <tr>
                <td>
                    <label>
                        Username*</label>
                </td>
                <td>
                 
                    <asp:TextBox ID="uxUserName" runat="server" />
                </td>
                <td><asp:RequiredFieldValidator ID="reqUserName" runat="server" controltovalidate="uxUserName" ErrorMessage="<%$ Resources:Error, 0001 %>"></asp:RequiredFieldValidator></td>
            </tr>
            <tr>
                <td>
                        E-mail*
                </td>
                <td>

                    <asp:TextBox ID="txtEmail" runat="server" />
                </td>
                <td>
                 <asp:RequiredFieldValidator ID="reqEmail" runat="server" controltovalidate="txtEmail" ErrorMessage="<%$ Resources:Error, 0001 %>"></asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="regexEmailValid" runat="server" ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" ControlToValidate="txtEmail" ErrorMessage="<%$ Resources:Error, 0003 %>"></asp:RegularExpressionValidator>

                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>
                    <asp:CheckBox Text="Enabled" runat="server" ID="checkboxEnabled" Checked="true"/>
                </td>
            </tr>
            <tr>
            <td>
            Role
            </td>
            <td>
                <asp:TextBox runat="server"  ID="uxRole" OnTextChanged="roleSearch_OnTextChanged"/>
            </td>
            </tr>
            <tr>
            <td>
             <asp:GridView runat="server" ID="uxRolesList" DataSourceID="uxRolesListSource">
                    <Columns>
            <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                        <asp:TemplateField HeaderText="">
                        <HeaderTemplate>
                <asp:CheckBox runat="server" ID="HeaderCheckBox" />
            </HeaderTemplate>

                            <ItemTemplate>
                                <asp:CheckBox ID="checkBox" runat="server" />
                                  </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
                   <WCSF:ObjectContainerDataSource runat="server" ID="uxRolesListSource" UsingServerPaging="true" UsingServerSorting="true"
        OnSelecting="uxRolesList_Selecting" />
            </td>
            </tr>
        </table>
    </div>
                    </ContentTemplate>
                    <FooterTemplate>
                        <div>
                            <asp:Button runat="server" ID="uxSave" Text="Save" />
                            <asp:Button runat="server" ID="uxCancel" Text="Cancel" OnClick="uxCancel_Click" />
                        </div>
                    </FooterTemplate>
                </mtl:Popup>


            </td>
        </tr>
    </table>
    <br />
    <asp:GridView runat="server" ID="uxUsersList" DataSourceID="uxUsersListSource" AllowPaging="True"
        AutoGenerateColumns="False" PageIndex="1" AllowSorting="True" OnRowCommand="uxUsersList_RowCommand">
        <Columns>
            <asp:TemplateField HeaderText="Full Name" SortExpression="FullName">
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButtonFullName" runat="server" OnClick="fullName_Click" Text='<%# Eval("FullName") %>'
                        CommandName="Editing" CommandArgument='<%# Eval("Id") %>'></asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="Username" HeaderText="Username" SortExpression="Username" />
            
            <asp:BoundField DataField="Email" HeaderText="E-mail" NullDisplayText="---" DataFormatString="<a href=mailto:{0}>{0}</a>" HtmlEncodeFormatString="false"/>

            <asp:BoundField DataField="CreationDate" HeaderText="Created On" SortExpression="CreationDate" />
            <asp:TemplateField HeaderText="Delete">
                <ItemTemplate>
                    <asp:ImageButton ID="uxDeleteButton" runat="server" CommandName="Deleting" ImageUrl="~/Images/Delete16.png" 
                    CommandArgument='<%# Eval("Id") %>'/>
                     <ajax:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" TargetControlID="uxDeleteButton" ConfirmText="<%$ Resources:Confirmation, 0001 %>">
                                </ajax:ConfirmButtonExtender>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    <WCSF:ObjectContainerDataSource runat="server" ID="uxUsersListSource" UsingServerPaging="true"
        UsingServerSorting="true" OnSelecting="uxUsersListSource_Selecting" DataObjectTypeName="ModulesToolkit.DataContracts.Membership.UserDto" />
   
</asp:Content>
<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="uxScriptPlaceHolder">
</asp:Content>
